package cn.hm.search;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories;

/**
 * 搜索主启动类
 * @author Mxb
 * @version 1.0
 * @date 2020/9/28 20:04
 */
// 排除数据库加载，这里只需要调用feign查询就可以了
@SpringBootApplication(exclude={DataSourceAutoConfiguration.class})
@EnableEurekaClient
// 开启feign调用
@EnableFeignClients(basePackages = {"cn.hm.goods.api.feign"})
// 开启ES 设置dao的位置
@EnableElasticsearchRepositories(basePackages = {"cn.hm.search.dao"})
public class SearchApplication {

    public static void main(String[] args) {
        /**
         * Springboot整合Elasticsearch 在项目启动前设置一下的属性，防止报错
         * 解决netty冲突后初始化client时还会抛出异常
         * availableProcessors is already set to [12], rejecting [12]
         ***/
        System.setProperty("es.set.netty.runtime.available.processors", "false");
        SpringApplication.run(SearchApplication.class,args);
    }
}
